package charpter11.lynx;

import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
import java.util.Random;

public class Twelve {
	public static void main(String[] args){
		List<Integer> list1 = new ArrayList<Integer>();
		List<Integer> list2 = new ArrayList<Integer>();
		Random rd = new Random(47);
		
		for (int i = 0; i < 50; i++){
			list1.add(rd.nextInt(100));
		}
		ListIterator<Integer> it1 = list1.listIterator(list1.size());//初始化就用size，这样previous就是最后一个了
		while (it1.hasPrevious()) {
			list2.add(it1.previous());
		}
		System.out.println(list1);
		System.out.println(list2);
	}
}
